<template>
  <el-table :data="tableData">
    <el-table-column
      v-for="(item, index) in columnList"
      :key="index"
      :prop="item.prop"
      :label="item.label"
    />
  </el-table>
</template>

<script>
import { getTableData } from '@/api/chart'
export default {
  props: {
    chartMode: Object
  },
  data() {
    return {
      columnList: [],
      tableData: []
    }
  },
  methods: {
    fetchData() {
      getTableData(this.chartMode).then((data) => {
        this.columnList = data.columnList
        this.tableData = data.dataList
      }).catch((err) => {
          this.$confirmError(err)
        })
    }
  },
  mounted() {
    this.fetchData()
  }
}
</script>

<style>
</style>
